#ifndef FUNCTION_H
#define FUNCTION_H

/*!
This is the smallest member of the entity framework. This holds each function's data seperately while keeping track if important line information to be
used when setting the criteria test
*/

/**
* \class Function
* \brief This is the smallest member of the Program. This holds each function's data seperately while keeping track if important line information to be
*used when setting the criteria test or retreaving regression test rules
* \author Elie M. Shaccour (elie.shaccour@gmail.com)
* 
*/

class Function{

private:
/*! holds the lines of the function */
	std::vector<std::string> Lines;
/// name of the function with parameters
	std::string NameParametrized;
/// name of the function without parameters
	std::string NameOnly;
/*! holds the scope name, i.e. the first member in "int foo()" would be foo, each '{' increments the scope and the control variable before the '{' is added to this 
variable */
	std::vector<std::string> Scopes;

/*! holds a pointer to the scope of this line w.r.t. scope, i.e. if line_scope=0, then the scope of this line is the 1st item on variable scope*/
	std::vector<int> LineScopes;
///Path of the current project
	std::string Directory_Path;
/*! holds current scope */
	int ScopePointer;//ScopePointer=-1 => function param, ScopePointer=0 => function scope ,.....etc.
/*! holds the beginning of the function in its original file*/
	int PositionInFile;
public:
        /**     \brief Constructore
        *       \param Name Full path of the project 
	*	\param Position Location in the original file at which it starts
        */
	Function(std::string Name,int Position);
	~Function();

        /**     \brief Adds a line to the current function
        *       \param Line The line to be added
        *       \return True if addition is successfull
        */
	bool AddLine(std::string Line);

        /**     \brief Get the source code lines of the current project 
        *       \param Numbered takes boolean as parameter if we need the lines to be numbered. By default set to true
        *       \return String holding the lines in the project
        */
	std::string GetLines(bool Numbered=true);//By default they are numbered for the CMD, providing the unnumbered state for the GUI

        /**     \brief Get the name of the function with signature
        *       \return Name of Function with parameters
        */
	std::string GetNameParametrized();

        /**     \brief Get specific line from the function
        *       \param LinePosition line number whose text should be retrieved
        *       \return String of the line at position requested
        */
	std::string GetLineAtPosition(int LinePosition);

        /**     \brief Get scope of a specific line in the function
        *       \param LinePosition line number whose scope should be retrieved
        *       \return Scope of the line at position requested
        */
	int GetScopeOfLineAtPosition(int LinePosition);

        /**     \brief Get function name without signature
        *       \return String name of the function without signature
        */
	std::string GetNameOnly();

        /**     \brief Get the line at which the function begins
        *       \return Position of where the function begins in the file specified
        */
	int GetPositionInFile();

        /**     \brief Get the number of lines in the function
        *       \return Total number of lines in the project
        */
	int GetLineCount();
};


#endif
